#-*- encoding: utf-8 -*-
'''
这个文件用来解析指定的历史数据文件,文件分文件头和数据段两个部分
文件头
第一行:股票代码,股票名称,数据类型
第二行:数据段名称
数据，逗号分隔的数据内容

Created on 2012-6-10

@author: Wen Tao
'''

import os
import fileinput
import sys
import csv

'''
class FileHisQuote():

    def __init__(self, params):
        pass
'''

def parseFile(fileName):
    try:
        if os.path.isfile(fileName)==False:
            return
            
        #with fileinput.input(fileName) as sf:
        #    for line in sf:
        #        print(line)
        
        quoteData = csv.reader(open(fileName))
        for row in quoteData:
            print(row)
    except IOError as err:
        print("I/O error: {0}".format(err))
    except:
        print("Unexpected error:", sys.exc_info()[0])      
    return